package net.yla.smartbus.core.constants;

import com.alibaba.fastjson.annotation.JSONType;

/**
 * @author wade
 * @date 2019/8/6
 */
@JSONType(serializeEnumAsJavaBean = true)
public enum  CalFlagEnum {

    NO_CONFIG(0,"未配置"),
    FAIL(2,"未完成"),
    NO_CALIBRATION(3,"未标定"),
    SUCCESS(1,"已完成");


    private int code;
    private String desc;

    CalFlagEnum(int code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static CalFlagEnum getByCode(Integer code){
        if(code==null){
            return null;
        }
        for(CalFlagEnum calFlagEnum : values()){
            if(code.equals(calFlagEnum.getCode())){
                return calFlagEnum;
            }
        }
        return null;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

}
